package com.onec.service.customer.entity.agent;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.onec.service.api.enums.CardTypeEnum;
import com.onec.service.api.enums.StatusEnum;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 在线订单实体
 * 渠道信息。
 *
 * @author ONEC
 */
@Data
@Entity
@Table(name = "t_agent_bank")
public class AgentBank implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true)
    private Long id;

    @Column(name = "version", length = 8)
    private Integer version;

    /**
     * 通道编号
     */
    @Column(name = "business_no", length = 16)
    private String businessNo;
    /**
     * 通道名称
     */
    @Column(name = "agent_id", length = 16)
    private Long agentId;

    @Column(name = "bank_code", length = 16)
    private String bankCode;

    /**
     * 联系人
     */
    @Column(name = "bank_name", length = 32)
    private String bankName;
    /**
     * 联系人
     */
    @Column(name = "card_type", length = 32)
    @Enumerated(EnumType.STRING)
    private CardTypeEnum cardType;
    /**
     * 机构编号
     */
    @Column(name = "amount_limit", length = 8, scale = 2)
    private BigDecimal amountLimit;
    /**
     * 机构编号
     */
    @Column(name = "day_amount_limit", length = 8, scale = 2)
    private BigDecimal dayAmountLimit;
    /**
     * 机构编号
     */
    @Column(name = "draw_fee", length = 8, scale = 1)
    private BigDecimal drawFee;
    /**
     * 机构编号
     */
    @Column(name = "month_amount_limit", length = 8, scale = 2)
    private BigDecimal monthAmountLimit;
    /**
     * 创建时间
     */
    @Column(name = "create_time", length = 0)
    @Temporal(TemporalType.TIMESTAMP)
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm", timezone = "GTM+8")
    private Date createTime;
    /**
     * 变更
     */
    @Column(name = "update_time", length = 0)
    @Temporal(TemporalType.TIMESTAMP)
    @LastModifiedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm", timezone = "GTM+8")
    private Date updateTime;
    /**
     * 创建者
     */
    @Column(name = "creator", length = 32)
    private String creator;
    /**
     * 产品备注
     */
    @Column(name = "remarks", length = 64)
    private String remarks;
    /**
     * 通道状态
     */
    @Column(name = "status", length = 12)
    @Enumerated(EnumType.STRING)
    private StatusEnum status;


    public AgentBank() {
    }

    public AgentBank(Integer version, String businessNo, Long agentId, String bankCode,
                     String bankName, CardTypeEnum cardType, BigDecimal amountLimit,
                     BigDecimal dayAmountLimit, BigDecimal drawFee, BigDecimal monthAmountLimit,
                     Date createTime, Date updateTime, String creator, String remarks, StatusEnum status) {
        this.version = version;
        this.businessNo = businessNo;
        this.agentId = agentId;
        this.bankCode = bankCode;
        this.bankName = bankName;
        this.cardType = cardType;
        this.amountLimit = amountLimit;
        this.dayAmountLimit = dayAmountLimit;
        this.drawFee = drawFee;
        this.monthAmountLimit = monthAmountLimit;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.creator = creator;
        this.remarks = remarks;
        this.status = status;
    }

}

